//
// Created by wang on 2021/7/4.
//

#ifndef ENET_SYS_H
#define ENET_SYS_H

#include "cmn.h"
#include "enet.h"
#include "etypes.h"

#define PIL_PIPE_R          (0x01)
#define PIL_PIPE_W          (0x10)
#define PIL_PIPE_RW         (PIL_PIPE_R | PIL_PIPE_W)
#define PIL_PIPE_ACC_R      (0x01)
#define PIL_PIPE_ACC_W      (0x10)
#define PIL_PIPE_ACC_RW     (PIL_PIPE_ACC_R | PIL_PIPE_ACC_W)
#define PIL_PIPE_BLOCK      1
#define PIL_PIPE_NONBLOCK   2
#define PIL_PIPE_NAME_LEN   64
#define PIL_PIPE_DESC_LEN   (PIL_PIPE_NAME_LEN + 10)

typedef struct {
    void *win_handle;
    int32_t handle;
} pil_pipe_handle;

uint32_t pil_getpid();
ret_t pil_device_mac(mac );
ret_t pil_create_pipe(const char *, uint8_t, uint32_t, char *);
ret_t pil_connect_pipe(const char *, uint8_t ,  pil_pipe_handle *);
ret_t pil_read_pipe(pil_pipe_handle *, byte *, uint32_t, unsigned long *);
ret_t pil_write_pipe(pil_pipe_handle *, byte *, uint32_t, unsigned long *);
void pil_sleep(uint32_t );

#endif //ENET_SYS_H
